<?php
/**
 * Created by PhpStorm.
 * User: leo
 * Date: 2018/5/21
 * Time: 10:38
 */
header('Content-Type:application/json');
include '../classes/logincheck.php';
include '../classes/conn.php';
if(islogin()!='stu_login') {
    die("error");
}

$class=$_POST['class'];
$query="select teacher from class where num='{$class}'";
$res=mysql_query($query);
$row=mysql_fetch_assoc($res);

$query="select name from teacher where num='{$row['teacher']}'";
$res=mysql_query($query);
$row2=mysql_fetch_assoc($res);

$data=array('teacher_num'=>$row['teacher'],'teacher_name'=>$row2['name']);
$data=json_encode($data);
echo $data;